package com.zl.smartmall.library.po;

import java.util.List;

import org.json.JSONException;
import org.json.JSONObject;

public class MyAddress {
	private int id;
	private int selected;
	private String nation;
	private String province;
	private String city;
	private String district;
	private String address;
	private String postcode;
	private String phone;
	private String receiver;
	private String addressparam;
	private String mallcomid;
	private String companyphone;
	private List<CustomerServiceInfo> customerServices;
	

	public List<CustomerServiceInfo> getCustomerServices() {
		return customerServices;
	}

	public void setCustomerServices(List<CustomerServiceInfo> customerServices) {
		this.customerServices = customerServices;
	}

	public String getCompanyphone() {
		return companyphone;
	}

	public void setCompanyphone(String companyphone) {
		this.companyphone = companyphone;
	}

	public String getMallcomid() {
		return mallcomid;
	}

	public void setMallcomid(String mallcomid) {
		this.mallcomid = mallcomid;
	}

	public String getAddressparam() {
		return addressparam;
	}

	public void setAddressparam(String addressparam) {
		this.addressparam = addressparam;
	}

	public int getId() {
		return id;
	}

	public int getSelected() {
		return selected;
	}

	public String getNation() {
		return nation;
	}

	public String getProvince() {
		return province;
	}

	public String getCity() {
		return city;
	}

	public String getDistrict() {
		return district;
	}

	public String getAddress() {
		return address;
	}

	public String getPostcode() {
		return postcode;
	}

	public String getPhone() {
		return phone;
	}

	public String getReceiver() {
		return receiver;
	}

	public void setId(int id) {
		this.id = id;
	}

	public void setSelected(int selected) {
		this.selected = selected;
	}

	public void setNation(String nation) {
		this.nation = nation;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public void setDistrict(String district) {
		this.district = district;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public void setPostcode(String postcode) {
		this.postcode = postcode;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public void setReceiver(String receiver) {
		this.receiver = receiver;
	}

	public static MyAddress parse(JSONObject jsonObject) throws JSONException {
		if (jsonObject != null && jsonObject.length() > 0) {
			MyAddress info = new MyAddress();
			info.setId(jsonObject.getInt("id"));
			info.setSelected(jsonObject.getInt("selected"));
			info.setAddress(jsonObject.getString("address"));
			info.setNation(jsonObject.getString("nation"));
			info.setProvince(jsonObject.getString("province"));
			info.setCity(jsonObject.getString("city"));
			info.setDistrict(jsonObject.getString("district"));
			info.setPostcode(jsonObject.getString("postcode"));
			info.setPhone(jsonObject.getString("phone"));
			info.setReceiver(jsonObject.getString("receiver"));
			info.setAddressparam(jsonObject.getString("address_param"));
			info.setMallcomid(jsonObject.getString("mall_com_id"));
			info.setCompanyphone(jsonObject.getString("tel"));
			info.setCustomerServices(CustomerServiceInfo.parse(jsonObject.getJSONArray("CustomerServices")));
			return info;
		}
		return null;
	}
}
